package mapper

import (
	"goproject/src/model"
	"gorm.io/gorm"
)

// 获取介质信息
func GetOrderItemList(db *gorm.DB) []model.DesOrderItem {
	var orderItem []model.DesOrderItem
	db.Find(&orderItem)
	return orderItem
}

func DeleteItemById(db *gorm.DB, id string) {
	db.Delete(&model.DesOrderItem{}, id)
}
func UpdateDesItem(db *gorm.DB, desOrderItem model.DesOrderItem) {
	db.Save(&desOrderItem)
}

func SaveDesItem(db *gorm.DB, desOrderItem model.DesOrderItem) {
	db.Create(&desOrderItem)
}
func BatchSaveDesItems(db *gorm.DB, desOrderItems []model.DesOrderItem) {
	db = db.Debug() // 开启debug模式
	db.CreateInBatches(&desOrderItems, 500)
}
